home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / aros / exec / closedevice.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-12  |  1.8 KB  |  85 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: closedevice.c,v 1.4 1996/08/13 13:55:59 digulla Exp $
  4.     $Log: closedevice.c,v $
  5.     Revision 1.4  1996/08/13 13:55:59  digulla
  6.     Replaced __AROS_LA by __AROS_LHA
  7.     Replaced some __AROS_LH*I by __AROS_LH*
  8.     Sorted and added includes
  9.  
  10.     Revision 1.3  1996/08/01 17:41:07  digulla
  11.     Added standard header for all files
  12.  
  13.     Desc:
  14.     Lang: english
  15. */
  16. #include <exec/execbase.h>
  17. #include <exec/io.h>
  18. #include <dos/dos.h>
  19. #include <aros/libcall.h>
  20.  
  21. /*****************************************************************************
  22.  
  23.     NAME */
  24.     #include <clib/exec_protos.h>
  25.  
  26.     __AROS_LH1(void, CloseDevice,
  27.  
  28. /*  SYNOPSIS */
  29.     __AROS_LHA(struct IORequest *, iORequest, A1),
  30.  
  31. /*  LOCATION */
  32.     struct ExecBase *, SysBase, 75, Exec)
  33.  
  34. /*  FUNCTION
  35.     Closes a previously opened device. Any outstanding I/O requests must
  36.     be finished. It is safe to call CloseDevice with a cleared iorequest
  37.     structure or one that failed to open.
  38.  
  39.     INPUTS
  40.     iORequest - Pointer to iorequest structure.
  41.  
  42.     RESULT
  43.  
  44.     NOTES
  45.  
  46.     EXAMPLE
  47.  
  48.     BUGS
  49.  
  50.     SEE ALSO
  51.     OpenDevice().
  52.  
  53.     INTERNALS
  54.  
  55.     HISTORY
  56.  
  57. ******************************************************************************/
  58. {
  59.     __AROS_FUNC_INIT
  60.  
  61.     /* Single-thread the close routine. */
  62.     Forbid();
  63.  
  64.     /* Something to do? */
  65.     if(iORequest->io_Device!=NULL)
  66.     {
  67.     (void)__AROS_LVO_CALL1(BPTR,2,iORequest->io_Device,iORequest,A1);
  68.     /*
  69.         Normally you'd expect the device to be expunged if this returns
  70.         non-zero, but this is only exec which doesn't know anything about
  71.         seglists - therefore dos.library has to SetFunction() into this
  72.         vector for the additional functionality.
  73.     */
  74.  
  75.     /* Trash device field */
  76.     iORequest->io_Device=(struct Device *)-1;
  77.     }
  78.  
  79.     /* All done. */
  80.     Permit();
  81.  
  82.     __AROS_FUNC_EXIT
  83. } /* CloseDevice */
  84.  
  85.